#include<bits/stdc++.h>
using namespace std;

class Treenode{
public:
	char c;
	Treenode* left;
	Treenode* right;
	Treenode(char c_){
		c=c_;left=nullptr;right=nullptr;
	}
	Treenode(char c_,Treenode* left_,Treenode* right_){
		c=c_;left=left_;right=right_;
	}
};

int n;
map<char,Treenode*> mymap;
string s;
void preorder(Treenode* root){
	if(!root) return;
	cout<<root->c;
	preorder(root->left);
	preorder(root->right);
}
int main(){
	cin>>n;
	if(n==0) return 0;
	cin>>s;
	auto root=new Treenode{s[0]};
	if(s[1]!='*'){
		root->left=new Treenode{s[1]};
		mymap[s[1]]=root->left;
	}
	if(s[2]!='*'){
		root->right=new Treenode{s[2]};
		mymap[s[2]]=root->right;
	}
	for(int i=1;i<n;i++){
		cin>>s;
		Treenode* r=mymap[s[0]];
		if(s[1]!='*'){
			r->left=new Treenode{s[1]};
			mymap[s[1]]=r->left;
		}
		if(s[2]!='*'){
			r->right=new Treenode{s[2]};
			mymap[s[2]]=r->right;
		}
	}
	preorder(root);
	return 0;
}
